package com.bw.zg3park2212.house

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.HouseEntity
import com.bw.base.entity.HouseEntityItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class HouseViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val houseSuccse=MutableLiveData<HouseEntity>()
    fun getHouse(regionId:Int){
        httpRequst(
            {apiService.gethouse(regionId)},
            houseSuccse::postValue
        )
    }
    val houseczSuccse=MutableLiveData<HouseEntityItem>()
    fun housecz(id:Int,rentDate:String){
        httpRequst(
            {apiService.gethouseCZ(id,rentDate)},
            houseczSuccse::postValue)
    }
    val housetzSuccse=MutableLiveData<HouseEntityItem>()
    fun housetz(id:Int){
        httpRequst(
            {apiService.gethouseTZ(id)},
            housetzSuccse::postValue)
    }
}